package com.xishu.entity.shop;

import com.xishu.annotation.dao.FieldMapping;
import com.xishu.annotation.dao.NotModify;
import com.xishu.annotation.oplog.OplogAnnotation;
import com.xishu.entity.AbstractEntity;
import com.xishu.entity.oplog.OpName;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 运营模式
 */
@Entity(name = "run_model")
@Table(indexes = {@Index(columnList = "shopId")})
public class RunModel extends AbstractEntity implements OpName {
    private static final long serialVersionUID = -438043401474918335L;

    @Transient
    private String opName;

    @ApiModelProperty(value = "分店ID")
    private Long shopId;

    @ApiModelProperty(value = "运营模式名称")
    private String name;

    @ApiModelProperty(value = "运用场景列表")
    @FieldMapping(desField = "runModuleSceneJson", serialize = true)
    @Transient
    private List<RunModuleScene> runModuleSceneList = new ArrayList<>();

    @ApiModelProperty(value = "运用场景列表")
    @FieldMapping(desField = "runModuleSceneList", serialize = false, genericType = "com.xishu.entity.shop.RunModuleScene")
    @Column(length = 1024)
    private String runModuleSceneJson;

    @ApiModelProperty(value = "是否启用")
    private Boolean enable;

    @ApiModelProperty(value = "运营模式类型, 目前界面上没有二维码的，都是服务员操作，分类如下：" +
            "0是服务员餐桌二维码,B端控制主页上餐桌点单，(B端)" +
            "1是总二维码,C端的总二维码，可以区分堂食和外卖，（C端）" +
            "2是堂食点单(自助快餐)，用于B端判断主页是否显示，（B端）" +
            "3是餐桌二维码点单（餐桌上固定的二维码点单），" +
            "4是服务员出单二维码点单（拼桌二维码点单），" +
            "5是服务员外卖点单（控制B端主页外卖，以及餐桌列表外卖），" +
            "6是外卖平台点单")
    @OplogAnnotation(fieldName = "运营模式类型")
    @NotModify
    private Integer modelType;

    @ApiModelProperty(value = "付款优先")
    private Boolean payFirst;

    @ApiModelProperty(value = "线上付款开启")
    private Boolean onlinePay;

    @ApiModelProperty(value = "堂食")
    private Boolean tangshi;

    @ApiModelProperty(value = "外卖")
    private Boolean takeout;

    public Boolean getPayFirst() {
        return payFirst;
    }

    public void setPayFirst(Boolean payFirst) {
        this.payFirst = payFirst;
    }

    public Boolean getOnlinePay() {
        return onlinePay;
    }

    public void setOnlinePay(Boolean onlinePay) {
        this.onlinePay = onlinePay;
    }

    public Integer getModelType() {
        return modelType;
    }

    public void setModelType(Integer modelType) {
        this.modelType = modelType;
    }

    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public List<RunModuleScene> getRunModuleSceneList() {
        return runModuleSceneList;
    }

    public void setRunModuleSceneList(List<RunModuleScene> runModuleSceneList) {
        this.runModuleSceneList = runModuleSceneList;
    }

    public String getRunModuleSceneJson() {
        return runModuleSceneJson;
    }

    public void setRunModuleSceneJson(String runModuleSceneJson) {
        this.runModuleSceneJson = runModuleSceneJson;
    }

    public Boolean getTangshi() {
        return tangshi;
    }

    public void setTangshi(Boolean tangshi) {
        this.tangshi = tangshi;
    }

    public Boolean getTakeout() {
        return takeout;
    }

    public void setTakeout(Boolean takeout) {
        this.takeout = takeout;
    }

    @Override
    public String getOpName() {
        return opName;
    }

    @Override
    public String opType() {
        return "运营模式";
    }

    @Override
    public String[] fieldName() {
        return new String[]{"shopId"};
    }

    @Override
    public void setOpName(String opName) {
        this.opName = opName;
    }
}